#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main_()
{
	unsigned long address;
	int *p,  num = 123;

	p = &num;
	address = (unsigned long)p;

    printf("%p:%p\n", &p, p);       // 0x7ffcf61bda38:0x7ffcf61bda34
	printf("address = 0x%016lx *p = %d p = %p\n", address, *p, p); // address = 0x7ffcf61bda34 *p = 123 p = 0x7ffcf61bda34
	printf("num = 0x%016lx num = %p\n", &num, &num);	// num = 0x7ffcf61bda34 num = 0x7ffcf61bda34

	return 0;
}

void p(int ** src, int * des)
{
  printf("[%p : %p : %p : %p] src *src **src &src\n", src, * src, ** src, & src); // 0x7ffcbfcfbd60 : 0x7ffcbfcfbd50 : 0xb : 0x7ffcbfcfbd38
  printf("[%p:%p:%p] des *des &des\n", des, * des, & des);	// 0x7ffcbfcfbd50:0xb:0x7ffcbfcfbd30

  des = * src;
  printf("[%p:%p:%p] des *des &des\n", des, * des, & des);	// 0x7ffcbfcfbd50:0xb:0x7ffcbfcfbd30
}

int main()
{
  int i = 8, j = 9;
  int ** shuan, * dan;
  
  i = j = 11;
  printf("%d %d %d\n", 0 % 10, i, j);	// 0, 11, 11

  dan = & i;
  shuan = & dan;

  printf("[%p : %p] i &i\n", i, &i);	// 0xb : 0x7ffcbfcfbd50
  printf("[%p: %p : %p] dan *dan &dan\n", dan , * dan, & dan);	// 0x7ffcbfcfbd50: 0xb : 0x7ffcbfcfbd60
  printf("[%p : %p : %p : %p] shuan *shuan **shuan &shuan\n", shuan, * shuan, ** shuan, & shuan);	// 0x7ffcbfcfbd60 : 0x7ffcbfcfbd50 : 0xb : 0x7ffcbfcfbd58

  //main_();
  p(shuan, dan);
}

